import 'package:flutter/material.dart';

class TestPage extends StatefulWidget {
  TestPage({Key? key}) : super(key: key);

  @override
  _TestPageState createState() {
    return _TestPageState();
  }
}

class _TestPageState extends State<TestPage> {

  TextEditingController eController = new TextEditingController();

  @override
  void initState() {
    super.initState();
    eController.addListener(() {
      print(eController.text);
    });
  }

  @override
  void dispose() {
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: AppBar(
        title: const Text("test_page"),
      ),
      body: Column(
        children: [
          const Text("test"),
          TextField(
            onChanged: (v) {
              print(v);
            },
            autofocus: true,
            decoration: InputDecoration(
                labelText: "用户名",
                hintText: '用户名或邮箱',
                prefixIcon: Icon(Icons.person)),
          ),
          TextField(
            controller: eController,
            decoration: InputDecoration(
                labelText: "密码",
                hintText: "您的登录密码",
                prefixIcon: Icon(Icons.lock)),
            obscureText: true,
          ),
        ],
      ),
    );
  }
}
